home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / URL Helper II / Source / URLHLibrary.h < prev   
Encoding:
C/C++ Source or Header  |  1994-08-14  |  2.7 KB  |  61 lines  |  [TEXT/MMCC]

  1. /***
  2.  * URLHLibrary.h
  3.  *
  4.  *  Library routines to make integration of the URLHelper component into
  5.  *  programs that much simpler...
  6.  *
  7.  ***/
  8.  
  9. #pragma once
  10.  
  11. #include "URLHelperComponent.h"
  12.  
  13. void URLHLibGetFirstMirror (StringPtr baseURL, StringPtr mirrorURL);
  14.  
  15. URLHParseRef URLHLibNewParseState (StringPtr baseURL);
  16. Boolean URLHLibGetIndexedMirror (URLHParseRef parseRef, short index, StringPtr mirrorURL); 
  17. void URLHLibDisposeParseState (URLHParseRef parseRef);
  18.  
  19. OSErr URLHLibOpen (void);
  20. void URLHLibClose (void);
  21. void URLHLibUse (URLHelperComponent instance);
  22.  
  23. /**
  24.  ** Routines
  25.  **
  26.  ** URLHLibGetFirstMirror -- Given a baseURL will return the primary mirror.  It will
  27.  **                            (should!) never fail.  If something goes wrong (the component
  28.  **                            isn't installed, etc.) it will return the baseURL in the mirrorURL.
  29.  **                            It is ok to have baseURL and mirrorURL point to the same memory
  30.  **                            location.
  31.  **
  32.  ** The next three routines are meant to be used together.  They enable one to get to more
  33.  ** that just the primary mirror in the mirror list (there can be any number of mirrors
  34.  ** in a particular mirror list).  For this you need to keep track of some temporary variable
  35.  ** that holds a "parse" state.  Again, these things are designed to work even if the component
  36.  ** is missing from the system.
  37.  **
  38.  ** URLHLibNewParseState -- Given a baseURL it will return a search/parse state.  Use this
  39.  **                         in calles to URLHLibGetIndexedMirror to get each and every mirror
  40.  **                            in the mirror list.
  41.  ** URLHLibGetIndexedMirror -- For the parse state and an index into the list, return a
  42.  **                            mirror url.  This will return true as long as index corresponds to
  43.  **                            a good mirror.
  44.  ** URLHLibDisposeParseState -- Get rid of the memory used to hold the parse state.
  45.  **
  46.  ** The next two routines are utility.  Only the second one, URLHLibClose, should be used in
  47.  ** an application... in general.  You can use URLHLibOpen to test to see if the component is
  48.  ** present in the system.
  49.  **
  50.  ** URLHLibOpen    -- No need for you to call this (called automatically).  It will attempt to
  51.  **                        open the component.  Returns -1 if it can't find the component.
  52.  **
  53.  ** URLHLibClose -- Close the connection to the component if it was open in the first place.
  54.  **                    If your program uses this component it is a good idea to call this
  55.  **                    before you exit (it dosen't matter if you didn't use the component during
  56.  **                    this run -- LibClose will only close the component if it was opened in the
  57.  **                    first place).
  58.  ** URLHLibUse -- Use a particular instance of the url helper component.  It will close
  59.  **                    any component it already had open (even if it was opened by this routine!)
  60.  **                    so watch it!
  61.  **/